from manimlib import *
from numpy import flip, insert

LV,QL,QH,JH='#75cfb8','#bbdfc8','#f0e5d8','#ffc478'

class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        # self.camera.frame.scale(0.5)
        # x^2+y^2=r^2 6,8,10
        x=ValueTracker(50)
        side,line,l_ri=1,1.25,0.75
        t=6
        side,line,l_ri=side*t,line*t,l_ri*t
        square=Square(side)
        a,b=square.get_boundary_point(UL),square.get_boundary_point(UR)
        e=b+DOWN*l_ri
        ae=Line(a,e).set_color(LV)
        arc=Arc(side/2,0,PI).shift(DOWN*side/2)
        self.add(square,arc,ae,
            Tex('A').next_to(a,UL),
            Tex('B').next_to(b,UR),
            Tex('C').next_to(square,DR),
            Tex('D').next_to(square,DL),
            Tex('E').next_to(e),
            Tex('P').shift(RIGHT*2)
        )
        self.wait()

class p2(Scene):
    def construct(self):
        # self.add(NumberPlane())
        # self.camera.frame.scale(0.5)
        # x^2+y^2=r^2 6,8,10
        x=ValueTracker(50)
        side,line,l_ri=1,1.25,0.75
        t=6
        side,line,l_ri=side*t,line*t,l_ri*t
        square=Square(side)
        a,b=square.get_boundary_point(UL),square.get_boundary_point(UR)
        e=b+DOWN*l_ri
        ae=Line(a,e).set_color(LV)
        arc=Arc(side/2,0,PI).shift(DOWN*side/2)
        self.add(square,arc,ae,
            Tex('A').next_to(a,UL),
            Tex('B').next_to(b,UR),
            Tex('C').next_to(square,DR),
            Tex('D').next_to(square,DL),
            Tex('E').next_to(e),
            Tex('P').shift(RIGHT*2)
        )
        # p2
        self.add(
            Tex('1').next_to(square,UP),
            Tex('1-x').next_to(Line(b,e)),
            Tex('1+x').set_color(LV).shift(UR*0.8)
        )
        self.wait()